﻿<%@ Page Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeFile="UserProfile.aspx.cs" Inherits="UserProfile" Title="Untitled Page" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
    <asp:LoginView ID="LoginViewFriendButtons" runat="server">
    <LoggedInTemplate>
        <asp:ImageButton ImageAlign="Right" ToolTip="Add user as a friend." ID="IdAddFriend" ImageUrl="images/useradd.png"  runat="server" OnClick="Add_Click"  Width=30 Height=30 />
        <asp:ImageButton ImageAlign="Right" ToolTip="Remove user from friends." ID="IdRemoveFriend" ImageUrl="images/userremove.png"  runat="server" OnClick="Delete_Click"  Width=30 Height=30 />
    </LoggedInTemplate>
    </asp:LoginView>
    <asp:Button ID="ButtonEdit" runat="server" Text="Edit" onclick="ButtonEdit_Click" Visible="false" />
    <asp:Label ID="LabelNume" runat="server" Text="Label"></asp:Label>
    <asp:Repeater runat="server" DataSourceID="SqlDataProfile"><ItemTemplate>
    <asp:Table ID="Table1" runat="server" Width=80%>
    <asp:TableRow  Height=100>
        <asp:TableCell Width=50%>
            Nume: <%# Eval("nume") %>
        </asp:TableCell>
        <asp:TableCell>
            Prenume: <%# Eval("prenume") %>
        </asp:TableCell>
    </asp:TableRow>
    <asp:TableRow Height=100>
        <asp:TableCell Width=50%>
            DataNastere: <%# Eval("data_nastere") %>
        </asp:TableCell>
        <asp:TableCell>
            Ocupatie: <%# Eval("ocupatie") %>
        </asp:TableCell>
    </asp:TableRow>
    <asp:TableRow>
        <asp:TableCell ColumnSpan=2>
            Status: <%# Eval("status") %>
        </asp:TableCell>
    </asp:TableRow>
    </asp:Table>
    </ItemTemplate></asp:Repeater>
    <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" 
        DataSourceID="SqlDataPrieteni" Width=100%>
        <Columns>
            <asp:HyperLinkField DataTextField="UserName" 
                HeaderText="Nume prieteni" DataNavigateUrlFields="id" 
                DataNavigateUrlFormatString="~/UserProfile.aspx?id={0}" />
            <asp:BoundField DataField="Status" HeaderText="Status-ul lor" />
        </Columns>
    </asp:GridView>
    <asp:SqlDataSource ID="SqlDataPrieteni" runat="server" 
        SelectCommand="SELECT usr.UserName AS UserName, pr.status AS Status, usr.UserId as id FROM Prieteni AS pi INNER JOIN Profile AS pr ON pr.id = pi.IdPrieten INNER JOIN aspnet_Users AS usr ON usr.UserId = pi.IdPrieten" 
        ConnectionString="<%$ ConnectionStrings:ConStrDinTren %>"></asp:SqlDataSource>
    <asp:SqlDataSource ID="SqlDataProfile" runat="server" 
        ConnectionString="<%$ ConnectionStrings:ConStrDinTren %>" SelectCommand="select * from profile" runat="server"></asp:SqlDataSource>
</asp:Content>

